package com.util;

import com.alibaba.fastjson.JSONObject;

import java.util.HashMap;
import java.util.List;
import java.util.Map;

public class StrToMapUtil {

    public static Map<String, String> strToMap(String str){
        String[] strList = str.split("&");
        Map<String, String> map = new HashMap<>();
        for (String keyValue: strList
             ) {
            String [] keyToValue = keyValue.split("=");
            String key = keyToValue[0];
            String value = keyToValue[1];
            if(key.length() > 0 && value.length() > 0){
                map.put(key, value);
            }
        }
        return map;
    }
}
